addpath('../lib');
addpath('../mockData');

disp('initial computations');


R = 5;
niter = 2000;

t = 0:0.3:10; %laikas
lam = 100:10:700; %bangos ilgiai

disp(size(t));
disp(size(lam));

spec = MockW5CGaussian(lam);
conc = MockH5CA2B2C(t);

PlotW(lam, spec, 'pradInfo');
PlotH(t, conc, 'pradInfo');

duomenys=spec*conc;

PlotMain(lam, t, duomenys, 'initialOveral');

%% standart NMF
disp('Computing NMF');

[W1 H1] = NMF(duomenys, R, niter);
PlotW(lam, W1, 'nmf');
PlotH(t, H1, 'nmf');
PlotMain(lam,t, W1*H1, 'nmf');
PlotMain(lam,t, duomenys - W1*H1, 'nmfDelta', 'norm', 0);
disp('Finished');
